#ifndef LAYERLISTUI_H_INCLUDED
#define LAYERLISTUI_H_INCLUDED

#include <gtkmm.h>
#include <gtkmm/main.h>
#include <gtkmm/window.h>
#include <iostream>
#include <list>

#include "Layer_List.h"
#include "CurrentContext.h"

using namespace std;
class LayerListUI;

class LayerListUIEntry:public Gtk::HBox
{
private:
	int m_ilayerId;
	bool deleted;
	Gtk::RadioButton m_crblayerCurrent;
	Gtk::CheckButton m_crbvisible;
	LayerListUIEntry(int layerId, Gtk::RadioButton::Group &group);

	~LayerListUIEntry();
	friend class LayerListUI;
};

inline LayerListUIEntry::LayerListUIEntry(int layerId, Gtk::RadioButton::Group &group) :
    m_ilayerId(layerId),
    m_crblayerCurrent(group, "curlayer"),
    m_crbvisible("visible")
{
    m_crblayerCurrent.set_active();
    m_crbvisible.set_active();
    pack_start(m_crblayerCurrent);
    pack_start(m_crbvisible);
    deleted = false;
    cout << "created entry" << endl;
};

class LayerListUI : public Gtk::VBox
{
    Gtk::VBox m_cvbLayerListUIEntryBox;
    Gtk::HBox m_chbAddRemoveLayerBox;
    Gtk::HBox m_chbShiftLayerBox;
    Gtk::Button m_cbLayerAdd;
    Gtk::Button m_cbLayerRemove;
    Gtk::Button m_cbLayerShiftUp;
    Gtk::Button m_cbLayerShiftDown;
    Gtk::RadioButton::Group m_crbGroup;

    Layer_List &m_layerList;
    CurrentContext &m_currentCtx;

    list<LayerListUIEntry *> m_layerListEntryList;

    public:
    virtual void on_addLayer_Button_clicked();
    virtual void on_removeLayer_Button_clicked();
    virtual void on_shiftLayerUp_Button_clicked();
    virtual void on_shiftLayerDown_Button_clicked();
    virtual void on_setActiveLayer_RadioButton_clicked();
    virtual void on_setLayerVisblie_RadioButton_clicked();

    LayerListUI();
    void clear();
};

#endif // LAYERLISTUI_H_INCLUDED
